<template>
  <div class="app-container">
    <!-- 信息列表 -->
    <div style="float: left; width: 100%">
      <el-table
        border
        v-loading="listLoading"
        :header-cell-style="{ background: '#FAFAFA' }"
        :data="certificateList"
        style="width: 100%"
      >
        <el-table-column prop="id" label="id"></el-table-column>
        <el-table-column prop="studentName" label="学员姓名"> </el-table-column>
        <el-table-column prop="idCard" label="学员身份证号"> </el-table-column>
        <el-table-column prop="courseName" label="课程名称"> </el-table-column>
        <el-table-column prop="grade" label="课程等级"> </el-table-column>
        <!-- 图片 -->
        <el-table-column
          label="证书图片"
          prop="eduCertificateInfo.cover"
        >
          <template slot-scope="scope">
            <el-image
              style="width: 110px; height: 60px"
              :src="scope.row.eduCertificateInfo.cover"
              :preview-src-list="[scope.row.eduCertificateInfo.cover]"
            ></el-image>
          </template>
        </el-table-column>

        <el-table-column
          label="录入日期"
          prop="date"
          :show-overflow-tooltip="true"
          sortable
        >
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { getCertificate } from "@/api/certificate";
export default {
  name: "certificateList",
  created: function () {
    this.getList();
  },
  data: function () {
    return {
      //表格加载遮罩
      listLoading: "false",
      //证书列表
      certificateCategoryList: [],
      //分页设置
      page: {
        current: 1,
        total: 0,
        size: 10,
      },
      //批量删除列表
      selectList: [],
      //证书列表
      certificateList: [],
      //学员编号
      studentId: this.$route.query.id,
    };
  },
  methods: {
    //获取记录列表
    getList: function () {
      //表格数据列表
      getCertificate(this.studentId).then((res) => {
        const data = res.data;
        this.page.total = data.total;
        this.certificateList = data.resList;
        this.listLoading = false;
      });
    },
    //跳转页面
    goto: function (current) {
      this.page.current = current;
      this.getList();
    },
    //页码改变
    sizeChange: function (size) {
      this.page.size = size;
      this.getList();
    },
  },
};
</script>

<style scoped>
</style>
